From: Jonas Dreßler Date: Fri, 5 Mar 2021 11:49:36 +0000 (+0100) Subject: st/label: Compare shadow spec before invalidating shadow on style change X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~530^2^2~7 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=09903b6426cbed58ebc316f51378e6525e80caec;p=gnome-shell.git st/label: Compare shadow spec before invalidating shadow on style change Just like with the last commit for StEntry, check whether the text shadow actually changed before invalidating the pipeline on style changes of StLabel. Part-of: --- diff --git a/src/st/st-label.c b/src/st/st-label.c index 1cf0859df..e9893fe01 100644 --- a/src/st/st-label.c +++ b/src/st/st-label.c @@ -62,6 +62,8 @@ struct _StLabelPrivate { ClutterActor *label; + StShadow *shadow_spec; + CoglPipeline *text_shadow_pipeline; float shadow_width; float shadow_height; @@ -119,8 +121,21 @@ static void st_label_style_changed (StWidget *self) { StLabelPrivate *priv = ST_LABEL(self)->priv; + StThemeNode *theme_node; + StShadow *shadow_spec; - g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + theme_node = st_widget_get_theme_node (self); + + shadow_spec = st_theme_node_get_text_shadow (theme_node); + if (!priv->shadow_spec || !shadow_spec || + !st_shadow_equal (shadow_spec, priv->shadow_spec)) + { + g_clear_pointer (&priv->text_shadow_pipeline, cogl_object_unref); + + g_clear_pointer (&priv->shadow_spec, st_shadow_unref); + if (shadow_spec) + priv->shadow_spec = st_shadow_ref (shadow_spec); + } _st_set_text_from_style ((ClutterText *)priv->label, st_widget_get_theme_node (self)); @@ -194,12 +209,10 @@ st_label_paint (ClutterActor *actor, ClutterPaintContext *paint_context) { StLabelPrivate *priv = ST_LABEL (actor)->priv; - StThemeNode *theme_node = st_widget_get_theme_node (ST_WIDGET (actor)); - StShadow *shadow_spec = st_theme_node_get_text_shadow (theme_node); st_widget_paint_background (ST_WIDGET (actor), paint_context); - if (shadow_spec) + if (priv->shadow_spec) { ClutterActorBox allocation; float width, height; @@ -222,7 +235,7 @@ st_label_paint (ClutterActor *actor, priv->shadow_width = width; priv->shadow_height = height; priv->text_shadow_pipeline = - _st_create_shadow_pipeline_from_actor (shadow_spec, + _st_create_shadow_pipeline_from_actor (priv->shadow_spec, priv->label); } @@ -232,7 +245,7 @@ st_label_paint (ClutterActor *actor, framebuffer = clutter_paint_context_get_framebuffer (paint_context); - _st_paint_shadow_with_opacity (shadow_spec, + _st_paint_shadow_with_opacity (priv->shadow_spec, framebuffer, priv->text_shadow_pipeline, &allocation,